using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class LIST_PRIInfo
    {
		#region Local Variable
		public enum Field
		{
			DTB,
			P06,
			P05,
			P04,
			P03,
			P02,
			P01,
			Description,
			Price01,
			Price02,
			Price03,
			Price04,
			CREATEDBY,
			MODIFIEDBY,
			CREATEDDATE,
			MODIFIEDDATE
		}
		private String _DTB;
		private String _P06;
		private String _P05;
		private String _P04;
		private String _P03;
		private String _P02;
		private String _P01;
		private String _Description;
		private Decimal _Price01;
		private Decimal _Price02;
		private Decimal _Price03;
		private Decimal _Price04;
		private String _CREATEDBY;
		private String _MODIFIEDBY;
		private Int32 _CREATEDDATE;
		private Int32 _MODIFIEDDATE;
		
		public String DTB{	get{ return _DTB;} set{_DTB = value;} }
		public String P06{	get{ return _P06;} set{_P06 = value;} }
		public String P05{	get{ return _P05;} set{_P05 = value;} }
		public String P04{	get{ return _P04;} set{_P04 = value;} }
		public String P03{	get{ return _P03;} set{_P03 = value;} }
		public String P02{	get{ return _P02;} set{_P02 = value;} }
		public String P01{	get{ return _P01;} set{_P01 = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public Decimal Price01{	get{ return _Price01;} set{_Price01 = value;} }
		public Decimal Price02{	get{ return _Price02;} set{_Price02 = value;} }
		public Decimal Price03{	get{ return _Price03;} set{_Price03 = value;} }
		public Decimal Price04{	get{ return _Price04;} set{_Price04 = value;} }
		public String CREATEDBY{	get{ return _CREATEDBY;} set{_CREATEDBY = value;} }
		public String MODIFIEDBY{	get{ return _MODIFIEDBY;} set{_MODIFIEDBY = value;} }
		public Int32 CREATEDDATE{	get{ return _CREATEDDATE;} set{_CREATEDDATE = value;} }
		public Int32 MODIFIEDDATE{	get{ return _MODIFIEDDATE;} set{_MODIFIEDDATE = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public LIST_PRIInfo()
		{
			_DTB = "";
			_P06 = "";
			_P05 = "";
			_P04 = "";
			_P03 = "";
			_P02 = "";
			_P01 = "";
			_Description = "";
			_Price01 = 0;
			_Price02 = 0;
			_Price03 = 0;
			_Price04 = 0;
			_CREATEDBY = "";
			_MODIFIEDBY = "";
			_CREATEDDATE = 0;
			_MODIFIEDDATE = 0;
		}
		public LIST_PRIInfo(
		String DTB,
		String P06,
		String P05,
		String P04,
		String P03,
		String P02,
		String P01,
		String Description,
		Decimal Price01,
		Decimal Price02,
		Decimal Price03,
		Decimal Price04,
		String CREATEDBY,
		String MODIFIEDBY,
		Int32 CREATEDDATE,
		Int32 MODIFIEDDATE
		)
		{
			_DTB = DTB;
			_P06 = P06;
			_P05 = P05;
			_P04 = P04;
			_P03 = P03;
			_P02 = P02;
			_P01 = P01;
			_Description = Description;
			_Price01 = Price01;
			_Price02 = Price02;
			_Price03 = Price03;
			_Price04 = Price04;
			_CREATEDBY = CREATEDBY;
			_MODIFIEDBY = MODIFIEDBY;
			_CREATEDDATE = CREATEDDATE;
			_MODIFIEDDATE = MODIFIEDDATE;
		}
		public LIST_PRIInfo(DataRow dr)
		{
			if (dr != null)
			{
				_DTB = dr[Field.DTB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DTB.ToString()]);
				_P06 = dr[Field.P06.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P06.ToString()]);
				_P05 = dr[Field.P05.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P05.ToString()]);
				_P04 = dr[Field.P04.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P04.ToString()]);
				_P03 = dr[Field.P03.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P03.ToString()]);
				_P02 = dr[Field.P02.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P02.ToString()]);
				_P01 = dr[Field.P01.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.P01.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Price01 = dr[Field.Price01.ToString()] == DBNull.Value?0:Convert.ToDecimal(dr[Field.Price01.ToString()]);
				_Price02 = dr[Field.Price02.ToString()] == DBNull.Value?0:Convert.ToDecimal(dr[Field.Price02.ToString()]);
				_Price03 = dr[Field.Price03.ToString()] == DBNull.Value?0:Convert.ToDecimal(dr[Field.Price03.ToString()]);
				_Price04 = dr[Field.Price04.ToString()] == DBNull.Value?0:Convert.ToDecimal(dr[Field.Price04.ToString()]);
				_CREATEDBY = dr[Field.CREATEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEDBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDDATE = dr[Field.CREATEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.CREATEDDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.MODIFIEDDATE.ToString()]);
			}
		}
		public LIST_PRIInfo(LIST_PRIInfo objEntr)
		{			
			_DTB = objEntr.DTB;			
			_P06 = objEntr.P06;			
			_P05 = objEntr.P05;			
			_P04 = objEntr.P04;			
			_P03 = objEntr.P03;			
			_P02 = objEntr.P02;			
			_P01 = objEntr.P01;			
			_Description = objEntr.Description;			
			_Price01 = objEntr.Price01;			
			_Price02 = objEntr.Price02;			
			_Price03 = objEntr.Price03;			
			_Price04 = objEntr.Price04;			
			_CREATEDBY = objEntr.CREATEDBY;			
			_MODIFIEDBY = objEntr.MODIFIEDBY;			
			_CREATEDDATE = objEntr.CREATEDDATE;			
			_MODIFIEDDATE = objEntr.MODIFIEDDATE;			
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("LIST_PRI");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.DTB.ToString(), typeof(String)),
				new DataColumn(Field.P06.ToString(), typeof(String)),
				new DataColumn(Field.P05.ToString(), typeof(String)),
				new DataColumn(Field.P04.ToString(), typeof(String)),
				new DataColumn(Field.P03.ToString(), typeof(String)),
				new DataColumn(Field.P02.ToString(), typeof(String)),
				new DataColumn(Field.P01.ToString(), typeof(String)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Price01.ToString(), typeof(Decimal)),
				new DataColumn(Field.Price02.ToString(), typeof(Decimal)),
				new DataColumn(Field.Price03.ToString(), typeof(Decimal)),
				new DataColumn(Field.Price04.ToString(), typeof(Decimal)),
				new DataColumn(Field.CREATEDBY.ToString(), typeof(String)),
				new DataColumn(Field.MODIFIEDBY.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDDATE.ToString(), typeof(Int32)),
				new DataColumn(Field.MODIFIEDDATE.ToString(), typeof(Int32))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.DTB.ToString()] = _DTB;
			row[Field.P06.ToString()] = _P06;
			row[Field.P05.ToString()] = _P05;
			row[Field.P04.ToString()] = _P04;
			row[Field.P03.ToString()] = _P03;
			row[Field.P02.ToString()] = _P02;
			row[Field.P01.ToString()] = _P01;
			row[Field.Description.ToString()] = _Description;
			row[Field.Price01.ToString()] = _Price01;
			row[Field.Price02.ToString()] = _Price02;
			row[Field.Price03.ToString()] = _Price03;
			row[Field.Price04.ToString()] = _Price04;
			row[Field.CREATEDBY.ToString()] = _CREATEDBY;
			row[Field.MODIFIEDBY.ToString()] = _MODIFIEDBY;
			row[Field.CREATEDDATE.ToString()] = _CREATEDDATE;
			row[Field.MODIFIEDDATE.ToString()] = _MODIFIEDDATE;
			return row;
		}
        #endregion InitTable
    }
}
